<?php
/**
 * Groups module for XOOPS
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code 
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright       The Groups Project http://code.google.com/p/groupsforxoops/
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package         groups
 * @since           2.3.0
 * @author          Hui Xiao < xh.8326@gmail.com >
 * @version         $Id: footer.php Sat Jul 18 12:40:19 CST 2009
 */

if ( !defined("XOOPS_ROOT_PATH") )  die("XOOPS root path not defined");

if ( !defined("XOOPS_FOOTER_INCLUDED") ) {
	define("XOOPS_FOOTER_INCLUDED",1);
	
	if ( isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && 
	$_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest" &&
	$_SERVER["REQUEST_METHOD"] === "POST")  {
		$xoopsTpl->display($xoopsOption['template_main']);
		exit;
	}
	$xoopsLogger->stopTime( 'Module display' );
	if (!headers_sent()) {
		header('Content-Type:text/html; charset='._CHARSET);
		header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
		//header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
		header('Cache-Control: private, no-cache');
		header('Pragma: no-cache');
	}
	//@internal: using global $xoTheme dereferences the variable in old versions, this does not
	if ( !isset( $xoTheme ) )	$xoTheme = $GLOBALS['xoTheme'];

	if ( isset( $xoopsOption['template_main'] ) && $xoopsOption['template_main'] != $xoTheme->contentTemplate ) {
		trigger_error( "xoopsOption[template_main] should be defined before including header.php", E_USER_WARNING );
		if ( false === strpos( $xoopsOption['template_main'], ':' ) ) {
			$xoTheme->contentTemplate = 'db:' . $xoopsOption['template_main'];
		} else {
			$xoTheme->contentTemplate = $xoopsOption['template_main'];
		}
	}
	$xoTheme->render();
	$xoopsLogger->stopTime();
}